<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客广场</title>
    <link rel="stylesheet" href="css/list.css">
    <link rel="stylesheet" href="css/blog_list.css">


</head>

<body>
    <!-- 导航栏 -->
    <div class="nav">
        <img src="img/logo.jpg" alt="">
        <span class="title">我的博客系统</span>
        <!-- 用来占据中间位置 -->
        <span class="spacer" style="width: 23%"></span>
        <div class="search">
            <input class="search-input" id="search-input" type="text" placeholder="输入文章标题">
            <button class="search-button" onclick="performSearch()">搜索</button>
        </div>

        <!-- 未登录显示元素 -->
        <span id="noneLoginElement">
            <a href="login.html">登录</a>
            <a href="reg.html">注册</a>
        </span>

        <!-- 已登录显示元素 -->
        <span id="userLoginElement" style="display: none;">
            <a href="myblog_list.html">个人博客</a>
            <a href="personal_center.html">个人中心</a>
            <a href="my_relation_following.html">我的关注/粉丝</a>
            <a href="private_message.html">聊天室</a>
            <a href="draft_list.html">我的草稿</a>
            <a href="blog_add.html">写博客</a>
            <a href="javascript:logout()">注销</a>
        </span>
    </div>
    <!-- 版心 -->
    <div class="container">
        <!-- 右侧内容详情 -->
        <div class="container-right" style="width: 100%;">
            <div id="artlist">
                <!-- 每一篇博客包含标题, 摘要, 时间 -->

            </div>
            <hr>
            <div id="pageDiv" class="blog-pagnation-wrapper">
                <button class="blog-pagnation-item" onclick="doFirst()">首页</button>
                <button class="blog-pagnation-item" onclick="doPrev()">上一页</button>
                <span id="pageIndex"></span>
                <button class="blog-pagnation-item" onclick="doNext()">下一页</button>
                <button class="blog-pagnation-item" onclick="doLast()">末页</button>
            </div>
        </div>
    </div>

    <script src="js/jquery.min.js"></script>
    <script src="./js/logout.js"></script>
    <script src="./js/islogin.js"></script>
    <script src="./js/urltools.js"></script>
    <script src="./js/blog_list.js"></script>

    <script>
        function performSearch() {
            var searchKey = jQuery("#search-input");
            if (searchKey.val().trim() == '') {
                alert("请先输入搜索关键字！");
                return;
            }

            console.log("搜索关键字：" + searchKey.val());
            var searchUrl = 'search_list.html?query=' + encodeURIComponent(searchKey.val());
            console.log("url：" + searchUrl);

            // 打开新窗口
            window.open(searchUrl, '_blank');
        }
    </script>
</body>

</html>